package com.xm;

/**
 * @Author：xm
 * @Project：runoob
 * @Date：2024/7/5 2:38
 */

public class Method02 {
    public static void main(String[] args) {
        int num1 = 1;
        int num2 = 2;

        System.out.println("交换前 num1的值为：" + num1 + "，num2的值为：" + num2);
        swap(num1, num2);
        System.out.println("交换后 num1的值为：" + num1 + "，num2的值为：" + num2);
    }

    // 值传递
    public static void swap(int a, int b) {
        System.out.println("进入swap方法");
        System.out.println("交换前a的值：" + a + "，b的值：" + b);
        int temp = a;
        a = b;
        b = temp;
        System.out.println("交换后a的值：" + a + "，b的值：" + b);

    }
}
